package com.orhon.smartcampus.modules.base.inputMapper;

import com.alibaba.fastjson.JSON;
import com.orhon.smartcampus.modules.base.gqlInputModel.GQLSchoolInput;
import com.orhon.smartcampus.basicComponents.ConvertHelper;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.Map;

@Mapper(uses = {
        ConvertHelper.class
})
public interface SchoolInputMapper {


    SchoolInputMapper MAPPER = Mappers.getMapper(SchoolInputMapper.class);

    default GQLSchoolInput mapInput(final Map map){
        String json = JSON.toJSONString(map);
        GQLSchoolInput input = JSON.parseObject(json , GQLSchoolInput.class);
        return input;
    }
}
